<%@ page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page isErrorPage="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>


<link rel="stylesheet" type="text/css" href="<c:url value="/resources/css/tabcontent.css"/>">
<link href="<c:url value="/resources/css/style.css"/>" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<c:url value="/resources/js/tabcontent.js"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/tiny_mce/tiny_mce.js"/>"></script>
<script type="text/javascript">
    tinyMCE.init({
        // General options
        mode: "textareas",
        theme: "advanced",
        plugins: "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,visualblocks",
        // Theme options
        theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3: "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4: "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft,visualblocks",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "bottom",
        theme_advanced_resizing: true,
        // Replace values for the template plugin
        template_replace_values: {
            username: "Some User",
            staffid: "991234"
        }
    });
</script>
<form action="<c:url value="/admin/savesanpham/${sanPham.getMaSp()}" />" method="post" style="margin:0; padding:0" onsubmit="return checkinputproduct(this)">
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tbody>
            <tr>
                <td class="bgtitle">
                    <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
                        <tbody>
                            <tr>
                                <td width="20">
                                    <img src="<c:url value="/resources/images/mui_ten.gif"/>">
                                </td>

                                <td valign="bottom" class="title">
                                    <a href="" class="linkcat20">Máy ảnh</a> 
                                    <img src="<c:url value="/resources/images/linev2.jpg"/>"> 
                                    <select name="hang" id="hang">
                                        <c:forEach var="hang" varStatus="hangCounter" items="${listHang}">
                                            <c:if test="${sanPham.getHang().getTenHang()==hang.getTenHang()}">
                                                <option value="${hang.getMaH()}" selected="selected">${hang.getTenHang()}</option>
                                            </c:if>

                                            <c:if test="${sanPham.getHang().getTenHang()!=hang.getTenHang()}">
                                                <option value="${hang.getMaH()}">${hang.getTenHang()}</option>
                                            </c:if>
                                        </c:forEach>

                                    </select>
                                </td>

                                <td width="10" valign="bottom">&nbsp;</td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <img src="<c:url value="/resources/images/space.gif"/>" width="1" height="10">
                </td>
            </tr>
            <tr>
                <td valign="top">
                    <table width="100%" style="border-collapse: collapse" border="0" cellpadding="0" cellspacing="0">
                        <tbody>
                            <tr>
                                <!-- Khung ảnh -->
                                <td valign="top" width="250">
                                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                        <tbody>
                                            <!-- Đường trên khung ảnh -->
                                            <tr>
                                                <td>
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tbody>
                                                            <tr>
                                                                <td width="11">
                                                                    <img src="<c:url value="/resources/images/tbl_pro1.jpg"/>" width="11" height="11">
                                                                </td>
                                                                <td background="<c:url value="/resources/images/tbl_pro2.jpg"/>">
                                                                    <img src="<c:url value="/resources/images/tbl_pro2.jpg"/>" width="1" height="11">
                                                                </td>
                                                                <td width="11">
                                                                    <img src="<c:url value="/resources/images/tbl_pro3.jpg"/>" width="11" height="11">
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                            <!-- Khung ảnh -->
                                            <tr>
                                                <td>
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tbody>
                                                            <tr>
                                                                <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro4.jpg"/>'); background-repeat:repeat-y; background-position:left top">
                                                                    <img src="<c:url value="/resources/images/tbl_pro4.jpg"/>" width="11" height="1">
                                                                </td>
                                                                <td>
                                                                    <div align="center">     
                                                                        <!-- Thay đổi ở đây -->
                                                                        <img src="<c:url value="/resources/images/product/${sanPham.getHinh()}"/>" alt="${sanPham.getTenSanPham()}" width="180" border="0">
                                                                    </div>
                                                                </td>
                                                                <td width="11" style="background-image:url('<c:url value="/resources/images/tbl_pro5.jpg"/>'); background-repeat:repeat-y; background-position:right top">
                                                                    <img src="<c:url value="/resources/images/tbl_pro5.jpg"/>" width="11" height="1">
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                            <!-- Đường dưới khung ảnh -->
                                            <tr>
                                                <td>
                                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                        <tbody>
                                                            <tr>
                                                                <td width="11">
                                                                    <img src="<c:url value="/resources/images/tbl_logo6.jpg"/>" width="11" height="11">
                                                                </td>
                                                                <td background="<c:url value="/resources/images/tbl_logo7.jpg"/>">
                                                                    <img src="<c:url value="/resources/images/tbl_logo7.jpg"/>" width="1" height="11">
                                                                </td>
                                                                <td width="11">
                                                                    <img src="<c:url value="/resources/images/tbl_logo8.jpg"/>" width="11" height="11">
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                                <td width="30">&nbsp;</td>
                                <!-- Thông tin chính của máy ảnh -->
                                <td valign="top">
                                    <!-- Tên của máy ảnh -->
                                    <table width="85%" border="0" cellpadding="5" cellspacing="0">
                                        <tbody>
                                            <tr>
                                                <td class="brd_bott" width="30%">
                                                    <strong>Tên sản phẩm:</strong>
                                                </td>
                                                <td class="brd_bott">
                                                    <input id="tensanpham" name="tensanpham" value="${sanPham.getTenSanPham()}"/>
                                                </td>
                                            </tr>

                                            <!-- Thông tin chính của máy ảnh -->


                                            <tr>
                                                <td class="brd_bott">
                                                    <strong>Giá tại MPShop:</strong>
                                                </td>

                                                <td class="brd_bott">
                                                    <!-- Thay đổi ở đây -->
                                                    <span>
                                                        <strong>
                                                            <input id="dongia" name="dongia" value="${sanPham.getDonGia()}"/> VNĐ
                                                        </strong>
                                                    </span>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td class="brd_bott">
                                                    <strong>Bảo hành:</strong>
                                                </td>
                                                <!-- Thay đổi ở đây -->
                                                <td class="brd_bott">
                                                    <input id="baohanh" name="baohanh" value="${sanPham.getBaoHanh()}"/><br>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="brd_bott">
                                                    <strong>Màu sắc:</strong>
                                                </td>
                                                <td class="brd_bott">
                                                    <table border="0" cellpadding="0" cellspacing="0">
                                                        <tbody>
                                                            <tr>
                                                                <td id="color" rowspan="2" style="margin-right:30px">

                                                                    <c:forEach var="mau" varStatus="mauCounter" items="${listMau}">
                                                                        
                                                                                <input type="checkbox" id="mau" name="mau${mauCounter.count}" value="${mau.getMaM()}">${mau.getTenMau()}
                                                                          
                                                                       

                                                                    </c:forEach>
                                                                </td>
                                                            </tr>
                                                        </tbody>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="brd_bott">
                                                    <strong>Kho hàng:</strong>
                                                </td>
                                                <!-- Thay đổi ở đây -->
                                                <td class="brd_bott">
                                                    <input id="soluongton"  name="soluongton" value="${sanPham.getSoLuongTon()}"/>

                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="brd_bott">
                                                    <strong>Kho hàng:</strong>
                                                </td>
                                                <!-- Thay đổi ở đây -->
                                                <td class="brd_bott">
                                                    <select id="tinhtrangsanpham" name="tinhtrangsanpham">
                                                        <c:forEach var="tinhtrangsanpham" varStatus="ttspCounter" items="${listTTSP}">
                                                            <option value="${tinhtrangsanpham.getMaTtsp()}">${tinhtrangsanpham.getTenTinhTrangSanPham()}</option>
                                                        </c:forEach>                    
                                                    </select>
                                                </td>
                                            </tr>
                                        <table>
                                            <tr>
                                                <td>
                                                    <input type="submit" id="editproduct" name="editproduct" value="Lưu CSDL">
                                                </td>
                                                <td>
                                                    <input type="reset" id="resetproduct" name="resetproduct" value="Làm lại">
                                                </td>
                                            </tr>
                                        </table>
                                    </table>
                        </tbody>
                    </table>
                </td>
            </tr>

    </table>
    <br>
    <!-- 3 menu cố định -->
    <div id="pettabs" class="indentmenu">
        <ul>
            <li>
                <a href="#" rel="dog1" class="selected">
                    <strong>Chi tiết sản phẩm</strong>
                </a>
            </li>

        </ul>
        <br style="clear: left">
    </div>

    <!-- Chọn menu nào thì tab đó xuất hiện -->
    <div style="border:1px solid #CCCCCC; width:750px; padding-bottom:10px; padding-left:10px; padding-right:10px; padding-top:10px;">
        <!-- Dog 1, chèn nội dung vào đây --->
        <div id="dog1" class="tabcontent" style="display: block;">

            <textarea id="chitietsanpham" name="chitietsanpham" rows="55" cols="90" style="width: 100%">${sanPham.getChiTietSanPham().getHinh()}
            </textarea>

        </div>
    </div>

</form>
<script type="text/javascript">
    var mypets = new ddtabcontent("pettabs")
    mypets.setpersist(true)
    mypets.setselectedClassTarget("link")
    mypets.init(0)
</script>
<br>

<!-- Sản phẩm khác -->
